/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 * tipo de letra para botones: Ben Pionner
 */

/*
 * Principal2.java
 *
 * Created on 28/10/2011, 04:33:12 PM
 */
package vista;
import controlador.CargaPanel;
import controlador.ContenedorComponente;
import controlador.ControlEventos;
import logica.FechaHora;
import dao.HistorialDAO;
import dao.UsuarioDAO;
import java.util.List;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.table.DefaultTableModel;
import logica.OperacionBaseDatos;
import logica.ProcesaPuertoSerial;
import logica.pruebaHora;
import modelo.Historial;
import modelo.Usuario;
//import snoozesoft.systray4j.SysTrayMenuEvent;
//import snoozesoft.systray4j.SysTrayMenuListener;
//letra been pioner tamaño 15
/**
 *
 * @author Elias Mendoza
 */
public class Principal2 extends javax.swing.JFrame {
  JPanel panel;
  CargaPanel cargaPanel;
  FechaHora fh;
  ControlEventos accion;
  ContenedorComponente cc;

  

  /** Creates new form Principal2 */
  public Principal2() {
    initComponents();
    cargaPanel= new CargaPanel(contenedorPanel);
    fh = new FechaHora(hora,fecha);
    
    cc = new ContenedorComponente(ultFecha, ultFecha, ultHora, ultRegistro, conectar, datosRecibidos, tablaDatosR, labelEstadoPuerto, labelPuerto, puerto,panelGrafica1);
    accion = new ControlEventos(cc);
  }
 

  /** This method is called from within the constructor to
   * initialize the form.
   * WARNING: Do NOT modify this code. The content of this method is
   * always regenerated by the Form Editor.
   */
  @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jScrollPane1 = new javax.swing.JScrollPane();
        Principal = new javax.swing.JPanel();
        jPanel1 = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        jLabel4 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jPanel5 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        panelFechaHora = new javax.swing.JPanel();
        fecha = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        hora = new javax.swing.JLabel();
        panelPuertoSeial = new javax.swing.JPanel();
        conectar = new javax.swing.JButton();
        puerto = new javax.swing.JComboBox();
        panelSistema = new javax.swing.JPanel();
        salir = new javax.swing.JButton();
        minimizar = new javax.swing.JButton();
        jPanel7 = new javax.swing.JPanel();
        jSplitPane3 = new javax.swing.JSplitPane();
        jLabel3 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        jSplitPane4 = new javax.swing.JSplitPane();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        jSeparator1 = new javax.swing.JSeparator();
        contenedor = new javax.swing.JTabbedPane();
        inicio = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        jPanel10 = new javax.swing.JPanel();
        jSplitPane5 = new javax.swing.JSplitPane();
        jLabel7 = new javax.swing.JLabel();
        labelPuerto = new javax.swing.JLabel();
        jSplitPane6 = new javax.swing.JSplitPane();
        jLabel15 = new javax.swing.JLabel();
        labelEstadoPuerto = new javax.swing.JLabel();
        jSplitPane7 = new javax.swing.JSplitPane();
        jLabel17 = new javax.swing.JLabel();
        jLabel18 = new javax.swing.JLabel();
        jSplitPane8 = new javax.swing.JSplitPane();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        datosRecibidos = new javax.swing.JTextArea();
        jPanel3 = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        tablaDatosR = new javax.swing.JTable();
        panelGrafica1 = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        jSplitPane1 = new javax.swing.JSplitPane();
        jLabel8 = new javax.swing.JLabel();
        ultFecha = new javax.swing.JTextField();
        jSplitPane2 = new javax.swing.JSplitPane();
        jLabel9 = new javax.swing.JLabel();
        ultHora = new javax.swing.JTextField();
        jPanel15 = new javax.swing.JPanel();
        jPanel17 = new javax.swing.JPanel();
        jScrollPane4 = new javax.swing.JScrollPane();
        jTable2 = new javax.swing.JTable();
        jLabel13 = new javax.swing.JLabel();
        jPanel11 = new javax.swing.JPanel();
        jLabel5 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();
        altas = new javax.swing.JPanel();
        jPanel12 = new javax.swing.JPanel();
        jPanel14 = new javax.swing.JPanel();
        jPanel19 = new javax.swing.JPanel();
        insertarProductor = new javax.swing.JButton();
        jPanel20 = new javax.swing.JPanel();
        insertarProducto = new javax.swing.JButton();
        jPanel21 = new javax.swing.JPanel();
        insertarSustrato = new javax.swing.JButton();
        jPanel22 = new javax.swing.JPanel();
        insertarReferencia = new javax.swing.JButton();
        jPanel23 = new javax.swing.JPanel();
        insertarNave = new javax.swing.JButton();
        contenedorPanel = new javax.swing.JPanel();
        jPanel13 = new javax.swing.JPanel();
        jPanel16 = new javax.swing.JPanel();
        jPanel18 = new javax.swing.JPanel();
        jPanel24 = new javax.swing.JPanel();
        jSplitPane11 = new javax.swing.JSplitPane();
        jLabel21 = new javax.swing.JLabel();
        ultFecha2 = new javax.swing.JTextField();
        jSplitPane12 = new javax.swing.JSplitPane();
        jLabel22 = new javax.swing.JLabel();
        ultHora1 = new javax.swing.JTextField();
        jSplitPane13 = new javax.swing.JSplitPane();
        jLabel23 = new javax.swing.JLabel();
        ultRegistro = new javax.swing.JTextField();
        jSplitPane14 = new javax.swing.JSplitPane();
        jLabel24 = new javax.swing.JLabel();
        ultFecha3 = new javax.swing.JTextField();
        jScrollPane5 = new javax.swing.JScrollPane();
        tablaDatosR1 = new javax.swing.JTable();
        jPanel25 = new javax.swing.JPanel();
        jPanel26 = new javax.swing.JPanel();
        jButton3 = new javax.swing.JButton();
        jLabel14 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        jPanel27 = new javax.swing.JPanel();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("SIRA");
        setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        getContentPane().setLayout(new javax.swing.BoxLayout(getContentPane(), javax.swing.BoxLayout.LINE_AXIS));

        Principal.setBackground(new java.awt.Color(236, 247, 247));

        jPanel1.setBackground(new java.awt.Color(255, 255, 255));
        jPanel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));

        jPanel6.setBackground(new java.awt.Color(255, 255, 255));
        jPanel6.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel6.setLayout(new java.awt.GridBagLayout());

        jLabel4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/sira.png"))); // NOI18N
        jPanel6.add(jLabel4, new java.awt.GridBagConstraints());

        jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/sistemariegoautomatico.png"))); // NOI18N
        jPanel6.add(jLabel2, new java.awt.GridBagConstraints());

        jPanel1.add(jPanel6);

        jPanel5.setBackground(new java.awt.Color(255, 255, 255));
        jPanel5.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jPanel5.setLayout(new javax.swing.BoxLayout(jPanel5, javax.swing.BoxLayout.Y_AXIS));

        jLabel1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/inifaplogo.jpg"))); // NOI18N
        jPanel5.add(jLabel1);

        jPanel1.add(jPanel5);

        jPanel2.setBackground(new java.awt.Color(255, 255, 255));
        jPanel2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(204, 204, 204)));
        jPanel2.setLayout(new java.awt.GridLayout(1, 0));

        panelFechaHora.setBackground(new java.awt.Color(255, 255, 255));
        panelFechaHora.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Fecha y Hora", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 14))); // NOI18N

        fecha.setText("2000-12-12");
        panelFechaHora.add(fecha);

        jLabel6.setText("--");
        panelFechaHora.add(jLabel6);

        hora.setText("00:00:00 am");
        panelFechaHora.add(hora);

        jPanel2.add(panelFechaHora);

        panelPuertoSeial.setBackground(new java.awt.Color(255, 255, 255));
        panelPuertoSeial.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Puerto Serial", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 14))); // NOI18N

        conectar.setBackground(new java.awt.Color(255, 255, 255));
        conectar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/conectar.png"))); // NOI18N
        conectar.setBorder(null);
        conectar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                conectarActionPerformed(evt);
            }
        });
        panelPuertoSeial.add(conectar);

        puerto.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "COM10", "COM133" }));
        panelPuertoSeial.add(puerto);

        jPanel2.add(panelPuertoSeial);

        panelSistema.setBackground(new java.awt.Color(255, 255, 255));
        panelSistema.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Sistema", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 14))); // NOI18N

        salir.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/salir.png"))); // NOI18N
        salir.setBorder(null);
        salir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                salirActionPerformed(evt);
            }
        });
        panelSistema.add(salir);

        minimizar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/minimizar.png"))); // NOI18N
        minimizar.setBorder(null);
        minimizar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                minimizarActionPerformed(evt);
            }
        });
        panelSistema.add(minimizar);

        jPanel2.add(panelSistema);

        jPanel7.setBackground(new java.awt.Color(255, 255, 255));
        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Usuario", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 14))); // NOI18N
        jPanel7.setLayout(new java.awt.BorderLayout());

        jSplitPane3.setEnabled(false);

        jLabel3.setBackground(new java.awt.Color(255, 255, 255));
        jLabel3.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel3.setText("Nombre: ");
        jSplitPane3.setLeftComponent(jLabel3);

        jLabel10.setBackground(new java.awt.Color(255, 255, 255));
        jLabel10.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel10.setText("nombre");
        jSplitPane3.setRightComponent(jLabel10);

        jPanel7.add(jSplitPane3, java.awt.BorderLayout.CENTER);

        jSplitPane4.setEnabled(false);

        jLabel11.setBackground(new java.awt.Color(255, 255, 255));
        jLabel11.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel11.setText("Tipo: ");
        jSplitPane4.setLeftComponent(jLabel11);

        jLabel12.setBackground(new java.awt.Color(255, 255, 255));
        jLabel12.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel12.setText("tipo");
        jSplitPane4.setRightComponent(jLabel12);

        jPanel7.add(jSplitPane4, java.awt.BorderLayout.PAGE_START);

        jPanel2.add(jPanel7);

        jSeparator1.setForeground(new java.awt.Color(51, 51, 255));

        contenedor.setBackground(new java.awt.Color(255, 255, 255));
        contenedor.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);
        contenedor.setFont(new java.awt.Font("Maiandra GD", 1, 14));

        inicio.setBackground(new java.awt.Color(255, 255, 255));
        inicio.setLayout(new java.awt.BorderLayout());

        jPanel4.setBackground(new java.awt.Color(255, 255, 255));
        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Información del Sistema y Datos Recibidos", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 14))); // NOI18N
        jPanel4.setLayout(new javax.swing.BoxLayout(jPanel4, javax.swing.BoxLayout.LINE_AXIS));

        jPanel10.setBackground(new java.awt.Color(255, 255, 255));
        jPanel10.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jSplitPane5.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane5.setEnabled(false);

        jLabel7.setFont(new java.awt.Font("Maiandra GD", 1, 15));
        jLabel7.setForeground(new java.awt.Color(51, 51, 51));
        jLabel7.setText("Puerto RS32: ");
        jSplitPane5.setLeftComponent(jLabel7);

        labelPuerto.setFont(new java.awt.Font("Maiandra GD", 1, 15));
        labelPuerto.setForeground(new java.awt.Color(51, 102, 255));
        labelPuerto.setText("00");
        jSplitPane5.setRightComponent(labelPuerto);

        jSplitPane6.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane6.setEnabled(false);

        jLabel15.setFont(new java.awt.Font("Maiandra GD", 1, 14));
        jLabel15.setForeground(new java.awt.Color(51, 51, 51));
        jLabel15.setText("Estado: ");
        jSplitPane6.setLeftComponent(jLabel15);

        labelEstadoPuerto.setFont(new java.awt.Font("Maiandra GD", 1, 14));
        labelEstadoPuerto.setForeground(new java.awt.Color(204, 51, 0));
        labelEstadoPuerto.setText("desconectado");
        jSplitPane6.setRightComponent(labelEstadoPuerto);

        jSplitPane7.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane7.setEnabled(false);

        jLabel17.setFont(new java.awt.Font("Maiandra GD", 1, 15));
        jLabel17.setForeground(new java.awt.Color(51, 51, 51));
        jLabel17.setText("Base Datos: ");
        jSplitPane7.setLeftComponent(jLabel17);

        jLabel18.setFont(new java.awt.Font("Maiandra GD", 1, 15));
        jLabel18.setForeground(new java.awt.Color(51, 102, 255));
        jSplitPane7.setRightComponent(jLabel18);

        jSplitPane8.setBackground(new java.awt.Color(255, 255, 255));
        jSplitPane8.setEnabled(false);

        jLabel19.setFont(new java.awt.Font("Maiandra GD", 1, 14));
        jLabel19.setForeground(new java.awt.Color(51, 51, 51));
        jLabel19.setText("Estado: ");
        jSplitPane8.setLeftComponent(jLabel19);

        jLabel20.setFont(new java.awt.Font("Maiandra GD", 1, 14));
        jLabel20.setForeground(new java.awt.Color(204, 51, 0));
        jLabel20.setText("desconectado");
        jSplitPane8.setRightComponent(jLabel20);

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jSplitPane5)
                    .addComponent(jSplitPane7)
                    .addComponent(jSplitPane6, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jSplitPane8, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jSplitPane5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSplitPane6, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSplitPane7, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSplitPane8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel4.add(jPanel10);

        datosRecibidos.setColumns(10);
        datosRecibidos.setFont(new java.awt.Font("Times New Roman", 1, 14));
        datosRecibidos.setLineWrap(true);
        datosRecibidos.setRows(5);
        jScrollPane2.setViewportView(datosRecibidos);

        jPanel4.add(jScrollPane2);

        inicio.add(jPanel4, java.awt.BorderLayout.PAGE_START);

        jPanel3.setBackground(new java.awt.Color(255, 255, 255));
        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Registro", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 14))); // NOI18N

        jPanel8.setBackground(new java.awt.Color(255, 255, 255));

        tablaDatosR.setBackground(new java.awt.Color(241, 251, 251));
        tablaDatosR.setFont(new java.awt.Font("Times New Roman", 1, 18));
        tablaDatosR.setForeground(new java.awt.Color(51, 51, 255));
        tablaDatosR.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null},
                {null, null, null}
            },
            new String [] {
                "Sensor", "Humedad", "Vol. Referencia"
            }
        ));
        jScrollPane3.setViewportView(tablaDatosR);

        panelGrafica1.setBackground(new java.awt.Color(240, 250, 248));
        panelGrafica1.setLayout(new java.awt.CardLayout());

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 238, Short.MAX_VALUE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(panelGrafica1, javax.swing.GroupLayout.PREFERRED_SIZE, 555, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 280, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(panelGrafica1, javax.swing.GroupLayout.PREFERRED_SIZE, 292, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel9.setBackground(new java.awt.Color(255, 255, 255));
        jPanel9.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        jSplitPane1.setEnabled(false);

        jLabel8.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel8.setText("Fecha: ");
        jSplitPane1.setLeftComponent(jLabel8);

        ultFecha.setFont(new java.awt.Font("Times New Roman", 1, 14));
        ultFecha.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ultFechaActionPerformed(evt);
            }
        });
        jSplitPane1.setRightComponent(ultFecha);

        jPanel9.add(jSplitPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 150, -1));

        jSplitPane2.setEnabled(false);

        jLabel9.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel9.setText("Ult. Hora:");
        jSplitPane2.setLeftComponent(jLabel9);

        ultHora.setFont(new java.awt.Font("Times New Roman", 1, 14));
        ultHora.setText("12.00.00 am");
        ultHora.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ultHoraActionPerformed(evt);
            }
        });
        jSplitPane2.setRightComponent(ultHora);

        jPanel9.add(jSplitPane2, new org.netbeans.lib.awtextra.AbsoluteConstraints(158, 0, 150, -1));

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, 353, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );

        inicio.add(jPanel3, java.awt.BorderLayout.CENTER);

        contenedor.addTab("Inicio", inicio);

        jPanel15.setLayout(new java.awt.GridLayout(1, 0));

        jPanel17.setBackground(new java.awt.Color(255, 255, 255));
        jPanel17.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel17.setLayout(new java.awt.BorderLayout());

        jTable2.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null},
                {null, null, null, null, null, null}
            },
            new String [] {
                "Valvula", "Estado", "Sustrato", "Nave", "Tiempo/Abierta", "Litros/Regados"
            }
        ));
        jScrollPane4.setViewportView(jTable2);

        jPanel17.add(jScrollPane4, java.awt.BorderLayout.CENTER);

        jLabel13.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel13.setText("Detalle de Valvulas");
        jPanel17.add(jLabel13, java.awt.BorderLayout.PAGE_START);

        jPanel15.add(jPanel17);

        jPanel11.setLayout(new java.awt.BorderLayout());

        jLabel5.setText("jLabel5");
        jPanel11.add(jLabel5, java.awt.BorderLayout.CENTER);

        jButton1.setText("Todo Registros");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jPanel11.add(jButton1, java.awt.BorderLayout.PAGE_START);

        jButton2.setText("Verifica Historial");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });
        jPanel11.add(jButton2, java.awt.BorderLayout.LINE_START);

        jPanel15.add(jPanel11);

        contenedor.addTab("Estados de Valvulas", jPanel15);

        altas.setBackground(new java.awt.Color(255, 255, 255));
        altas.setAutoscrolls(true);

        jPanel12.setBackground(new java.awt.Color(255, 255, 255));
        jPanel12.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        jPanel14.setBackground(new java.awt.Color(255, 255, 255));

        jPanel19.setBackground(new java.awt.Color(255, 255, 255));
        jPanel19.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Productor", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 12))); // NOI18N

        insertarProductor.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/insertar.png"))); // NOI18N
        insertarProductor.setBorder(null);
        insertarProductor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                insertarProductorActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel19Layout = new javax.swing.GroupLayout(jPanel19);
        jPanel19.setLayout(jPanel19Layout);
        jPanel19Layout.setHorizontalGroup(
            jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 244, Short.MAX_VALUE)
            .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel19Layout.createSequentialGroup()
                    .addGap(0, 71, Short.MAX_VALUE)
                    .addComponent(insertarProductor)
                    .addGap(0, 72, Short.MAX_VALUE)))
        );
        jPanel19Layout.setVerticalGroup(
            jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 39, Short.MAX_VALUE)
            .addGroup(jPanel19Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel19Layout.createSequentialGroup()
                    .addGap(0, 5, Short.MAX_VALUE)
                    .addComponent(insertarProductor)
                    .addGap(0, 5, Short.MAX_VALUE)))
        );

        jPanel20.setBackground(new java.awt.Color(255, 255, 255));
        jPanel20.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Producto", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 12))); // NOI18N

        insertarProducto.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/insertar.png"))); // NOI18N
        insertarProducto.setBorder(null);
        insertarProducto.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                insertarProductoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel20Layout = new javax.swing.GroupLayout(jPanel20);
        jPanel20.setLayout(jPanel20Layout);
        jPanel20Layout.setHorizontalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 244, Short.MAX_VALUE)
            .addGroup(jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel20Layout.createSequentialGroup()
                    .addGap(0, 71, Short.MAX_VALUE)
                    .addComponent(insertarProducto)
                    .addGap(0, 72, Short.MAX_VALUE)))
        );
        jPanel20Layout.setVerticalGroup(
            jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 39, Short.MAX_VALUE)
            .addGroup(jPanel20Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel20Layout.createSequentialGroup()
                    .addGap(0, 5, Short.MAX_VALUE)
                    .addComponent(insertarProducto)
                    .addGap(0, 5, Short.MAX_VALUE)))
        );

        jPanel21.setBackground(new java.awt.Color(255, 255, 255));
        jPanel21.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Sustrato", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 12))); // NOI18N

        insertarSustrato.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/insertar.png"))); // NOI18N
        insertarSustrato.setBorder(null);
        insertarSustrato.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                insertarSustratoActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel21Layout = new javax.swing.GroupLayout(jPanel21);
        jPanel21.setLayout(jPanel21Layout);
        jPanel21Layout.setHorizontalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 244, Short.MAX_VALUE)
            .addGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel21Layout.createSequentialGroup()
                    .addGap(0, 71, Short.MAX_VALUE)
                    .addComponent(insertarSustrato)
                    .addGap(0, 72, Short.MAX_VALUE)))
        );
        jPanel21Layout.setVerticalGroup(
            jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 39, Short.MAX_VALUE)
            .addGroup(jPanel21Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel21Layout.createSequentialGroup()
                    .addGap(0, 5, Short.MAX_VALUE)
                    .addComponent(insertarSustrato)
                    .addGap(0, 5, Short.MAX_VALUE)))
        );

        jPanel22.setBackground(new java.awt.Color(255, 255, 255));
        jPanel22.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Ref. Sustrato", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 12))); // NOI18N

        insertarReferencia.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/insertar.png"))); // NOI18N
        insertarReferencia.setBorder(null);
        insertarReferencia.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                insertarReferenciaActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel22Layout = new javax.swing.GroupLayout(jPanel22);
        jPanel22.setLayout(jPanel22Layout);
        jPanel22Layout.setHorizontalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 244, Short.MAX_VALUE)
            .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel22Layout.createSequentialGroup()
                    .addGap(0, 71, Short.MAX_VALUE)
                    .addComponent(insertarReferencia)
                    .addGap(0, 72, Short.MAX_VALUE)))
        );
        jPanel22Layout.setVerticalGroup(
            jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 39, Short.MAX_VALUE)
            .addGroup(jPanel22Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel22Layout.createSequentialGroup()
                    .addGap(0, 5, Short.MAX_VALUE)
                    .addComponent(insertarReferencia)
                    .addGap(0, 5, Short.MAX_VALUE)))
        );

        jPanel23.setBackground(new java.awt.Color(255, 255, 255));
        jPanel23.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Nave", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Maiandra GD", 1, 12))); // NOI18N

        insertarNave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/vista/img/insertar.png"))); // NOI18N
        insertarNave.setBorder(null);
        insertarNave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                insertarNaveActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel23Layout = new javax.swing.GroupLayout(jPanel23);
        jPanel23.setLayout(jPanel23Layout);
        jPanel23Layout.setHorizontalGroup(
            jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 244, Short.MAX_VALUE)
            .addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel23Layout.createSequentialGroup()
                    .addGap(0, 71, Short.MAX_VALUE)
                    .addComponent(insertarNave)
                    .addGap(0, 72, Short.MAX_VALUE)))
        );
        jPanel23Layout.setVerticalGroup(
            jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 39, Short.MAX_VALUE)
            .addGroup(jPanel23Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(jPanel23Layout.createSequentialGroup()
                    .addGap(0, 5, Short.MAX_VALUE)
                    .addComponent(insertarNave)
                    .addGap(0, 5, Short.MAX_VALUE)))
        );

        javax.swing.GroupLayout jPanel14Layout = new javax.swing.GroupLayout(jPanel14);
        jPanel14.setLayout(jPanel14Layout);
        jPanel14Layout.setHorizontalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jPanel20, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel21, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel22, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel23, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel19, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel14Layout.setVerticalGroup(
            jPanel14Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel14Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel19, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel20, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel21, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel22, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel23, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(115, Short.MAX_VALUE))
        );

        javax.swing.GroupLayout jPanel12Layout = new javax.swing.GroupLayout(jPanel12);
        jPanel12.setLayout(jPanel12Layout);
        jPanel12Layout.setHorizontalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
        );
        jPanel12Layout.setVerticalGroup(
            jPanel12Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel12Layout.createSequentialGroup()
                .addComponent(jPanel14, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(25, Short.MAX_VALUE))
        );

        contenedorPanel.setBackground(new java.awt.Color(204, 255, 204));
        contenedorPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        contenedorPanel.setAutoscrolls(true);
        contenedorPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
        contenedorPanel.setLayout(new java.awt.CardLayout(10, 20));

        javax.swing.GroupLayout altasLayout = new javax.swing.GroupLayout(altas);
        altas.setLayout(altasLayout);
        altasLayout.setHorizontalGroup(
            altasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(altasLayout.createSequentialGroup()
                .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(contenedorPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 524, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );
        altasLayout.setVerticalGroup(
            altasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(altasLayout.createSequentialGroup()
                .addGroup(altasLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel12, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(altasLayout.createSequentialGroup()
                        .addGap(11, 11, 11)
                        .addComponent(contenedorPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)))
                .addContainerGap())
        );

        contenedor.addTab("Registros", altas);

        jPanel16.setBackground(new java.awt.Color(255, 255, 255));
        jPanel16.setLayout(new java.awt.BorderLayout());

        jPanel18.setLayout(new javax.swing.BoxLayout(jPanel18, javax.swing.BoxLayout.Y_AXIS));

        jPanel24.setBackground(new java.awt.Color(255, 255, 255));
        jPanel24.setLayout(new javax.swing.BoxLayout(jPanel24, javax.swing.BoxLayout.LINE_AXIS));

        jSplitPane11.setEnabled(false);

        jLabel21.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel21.setText("Ultima Fecha: ");
        jSplitPane11.setLeftComponent(jLabel21);

        ultFecha2.setFont(new java.awt.Font("Times New Roman", 1, 14));
        ultFecha2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                ultFecha2ActionPerformed(evt);
            }
        });
        jSplitPane11.setRightComponent(ultFecha2);

        jPanel24.add(jSplitPane11);

        jSplitPane12.setEnabled(false);

        jLabel22.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel22.setText("Ultima Hora: ");
        jSplitPane12.setLeftComponent(jLabel22);

        ultHora1.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jSplitPane12.setRightComponent(ultHora1);

        jPanel24.add(jSplitPane12);

        jSplitPane13.setEnabled(false);

        jLabel23.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel23.setText("Ultimo Registro: ");
        jSplitPane13.setLeftComponent(jLabel23);

        ultRegistro.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jSplitPane13.setRightComponent(ultRegistro);

        jPanel24.add(jSplitPane13);

        jSplitPane14.setEnabled(false);

        jLabel24.setFont(new java.awt.Font("Maiandra GD", 1, 12));
        jLabel24.setText("Sustrato:");
        jSplitPane14.setLeftComponent(jLabel24);

        ultFecha3.setFont(new java.awt.Font("Times New Roman", 1, 14));
        jSplitPane14.setRightComponent(ultFecha3);

        jPanel24.add(jSplitPane14);

        jPanel18.add(jPanel24);

        tablaDatosR1.setFont(new java.awt.Font("Times New Roman", 1, 14));
        tablaDatosR1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Sensor", "Humedad Leida", "Vol. Referencia", "Estado Valvula"
            }
        ));
        jScrollPane5.setViewportView(tablaDatosR1);
        tablaDatosR1.getColumnModel().getColumn(3).setHeaderValue("Estado Valvula");

        jPanel18.add(jScrollPane5);

        jPanel16.add(jPanel18, java.awt.BorderLayout.PAGE_START);

        javax.swing.GroupLayout jPanel13Layout = new javax.swing.GroupLayout(jPanel13);
        jPanel13.setLayout(jPanel13Layout);
        jPanel13Layout.setHorizontalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel16, javax.swing.GroupLayout.DEFAULT_SIZE, 815, Short.MAX_VALUE)
                .addContainerGap())
        );
        jPanel13Layout.setVerticalGroup(
            jPanel13Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel13Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel16, javax.swing.GroupLayout.DEFAULT_SIZE, 531, Short.MAX_VALUE)
                .addContainerGap())
        );

        contenedor.addTab("Estado de Valvulas", jPanel13);

        jPanel25.setBackground(new java.awt.Color(251, 249, 240));

        jPanel26.setBackground(new java.awt.Color(255, 255, 255));

        jButton3.setText("jButton3");

        jLabel14.setText("jLabel14");

        jLabel16.setText("jLabel16");

        javax.swing.GroupLayout jPanel26Layout = new javax.swing.GroupLayout(jPanel26);
        jPanel26.setLayout(jPanel26Layout);
        jPanel26Layout.setHorizontalGroup(
            jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel26Layout.createSequentialGroup()
                .addGap(86, 86, 86)
                .addComponent(jButton3)
                .addGap(99, 99, 99)
                .addGroup(jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel16)
                    .addComponent(jLabel14))
                .addContainerGap(517, Short.MAX_VALUE))
        );
        jPanel26Layout.setVerticalGroup(
            jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel26Layout.createSequentialGroup()
                .addGap(34, 34, 34)
                .addGroup(jPanel26Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel14)
                    .addComponent(jButton3))
                .addGap(18, 18, 18)
                .addComponent(jLabel16)
                .addContainerGap(11, Short.MAX_VALUE))
        );

        jPanel27.setBackground(new java.awt.Color(255, 255, 255));

        javax.swing.GroupLayout jPanel27Layout = new javax.swing.GroupLayout(jPanel27);
        jPanel27.setLayout(jPanel27Layout);
        jPanel27Layout.setHorizontalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 815, Short.MAX_VALUE)
        );
        jPanel27Layout.setVerticalGroup(
            jPanel27Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 413, Short.MAX_VALUE)
        );

        javax.swing.GroupLayout jPanel25Layout = new javax.swing.GroupLayout(jPanel25);
        jPanel25.setLayout(jPanel25Layout);
        jPanel25Layout.setHorizontalGroup(
            jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel25Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jPanel27, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel26, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        jPanel25Layout.setVerticalGroup(
            jPanel25Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel25Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel26, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jPanel27, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
        );

        contenedor.addTab("Historial", jPanel25);

        javax.swing.GroupLayout PrincipalLayout = new javax.swing.GroupLayout(Principal);
        Principal.setLayout(PrincipalLayout);
        PrincipalLayout.setHorizontalGroup(
            PrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(PrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(contenedor, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 840, Short.MAX_VALUE)
                    .addGroup(PrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                        .addComponent(jPanel2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 840, Short.MAX_VALUE))
                .addContainerGap())
        );
        PrincipalLayout.setVerticalGroup(
            PrincipalLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(PrincipalLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 134, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(contenedor, javax.swing.GroupLayout.DEFAULT_SIZE, 585, Short.MAX_VALUE)
                .addContainerGap())
        );

        jScrollPane1.setViewportView(Principal);

        getContentPane().add(jScrollPane1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

  private void insertarProductorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_insertarProductorActionPerformed
    // TODO add your handling code here:
    cargaPanel.cargaPanelProductor();
  }//GEN-LAST:event_insertarProductorActionPerformed

  private void insertarProductoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_insertarProductoActionPerformed
    // TODO add your handling code here:
    cargaPanel.cargaPanelProducto();
  }//GEN-LAST:event_insertarProductoActionPerformed

  private void insertarSustratoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_insertarSustratoActionPerformed
    // TODO add your handling code here:
    cargaPanel.cargaPanelSustrato();
  }//GEN-LAST:event_insertarSustratoActionPerformed

  private void insertarReferenciaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_insertarReferenciaActionPerformed
    // TODO add your handling code here:
    cargaPanel.cargaPanelReferencia();
  }//GEN-LAST:event_insertarReferenciaActionPerformed

  private void insertarNaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_insertarNaveActionPerformed
    // TODO add your handling code here:
    cargaPanel.cargaPanelNave();
  }//GEN-LAST:event_insertarNaveActionPerformed

  private void salirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_salirActionPerformed
    // TODO add your handling code here:
    System.exit(0);
  }//GEN-LAST:event_salirActionPerformed

  private void conectarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_conectarActionPerformed
    // TODO add your handling code here:
    System.out.println("" + puerto.getSelectedItem());
    labelPuerto.setText("" + puerto.getSelectedItem());
    accion.eventoConectar("" + puerto.getSelectedItem());

  }//GEN-LAST:event_conectarActionPerformed

  private void minimizarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_minimizarActionPerformed
    // TODO add your handling code here:
//    UsuarioDAO ud = new UsuarioDAO();
//    Usuario u = new Usuario();
//    u.setDireccion("Conocida");
//    ud.guardar(u);
    HistorialDAO hd = new HistorialDAO();
    Historial h = new Historial();
    h.setDiaNoche(1);
//    pruebaHora ph = new pruebaHora();
    FechaHora ff = new FechaHora();
    h.setFecha(ff.getFecha());
    hd.guardar(h);
    System.out.println("El id insertado fue: "+h.getId());
  }//GEN-LAST:event_minimizarActionPerformed

private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
// TODO add your handling code here:
    Usuario h= new Usuario();
    UsuarioDAO hd = new UsuarioDAO();
    List lista=hd.consultaTodo();
    for(int i=0;i<lista.size();i++){
        h=(Usuario) lista.get(i);
        System.out.println("El Identificador es: "+h.getId());
    }
    System.out.println("El utlimo Registro insertado fue: "+hd.ultimoRegistro());
    
}//GEN-LAST:event_jButton1ActionPerformed

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
// TODO add your handling code here:
//    OperacionBaseDatos op = new OperacionBaseDatos();
//    op.verificaInsertaHistorial("0");
}//GEN-LAST:event_jButton2ActionPerformed

  private void ultFechaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ultFechaActionPerformed
    // TODO add your handling code here:
  }//GEN-LAST:event_ultFechaActionPerformed

  private void ultFecha2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ultFecha2ActionPerformed
    // TODO add your handling code here:
  }//GEN-LAST:event_ultFecha2ActionPerformed

  private void ultHoraActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ultHoraActionPerformed
    // TODO add your handling code here:
  }//GEN-LAST:event_ultHoraActionPerformed

  
  /**
   * @param args the command line arguments
   */
  public static void main(String args[]) {
    /* Set the Nimbus look and feel */
    //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
     * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
     */
    try {
      
      for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
        if ("Metal".equals(info.getName())) {
          javax.swing.UIManager.setLookAndFeel(info.getClassName());
          break;
        }
      }
    } catch (ClassNotFoundException ex) {
      java.util.logging.Logger.getLogger(Principal2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (InstantiationException ex) {
      java.util.logging.Logger.getLogger(Principal2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (IllegalAccessException ex) {
      java.util.logging.Logger.getLogger(Principal2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    } catch (javax.swing.UnsupportedLookAndFeelException ex) {
      java.util.logging.Logger.getLogger(Principal2.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
    }
    //</editor-fold>

    /* Create and display the form */
    java.awt.EventQueue.invokeLater(new Runnable() {

      public void run() {
        new Principal2().setVisible(true);
      }
    });
  }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel Principal;
    private javax.swing.JPanel altas;
    private javax.swing.JButton conectar;
    private javax.swing.JTabbedPane contenedor;
    private javax.swing.JPanel contenedorPanel;
    private javax.swing.JTextArea datosRecibidos;
    private javax.swing.JLabel fecha;
    private javax.swing.JLabel hora;
    private javax.swing.JPanel inicio;
    private javax.swing.JButton insertarNave;
    private javax.swing.JButton insertarProducto;
    private javax.swing.JButton insertarProductor;
    private javax.swing.JButton insertarReferencia;
    private javax.swing.JButton insertarSustrato;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel11;
    private javax.swing.JPanel jPanel12;
    private javax.swing.JPanel jPanel13;
    private javax.swing.JPanel jPanel14;
    private javax.swing.JPanel jPanel15;
    private javax.swing.JPanel jPanel16;
    private javax.swing.JPanel jPanel17;
    private javax.swing.JPanel jPanel18;
    private javax.swing.JPanel jPanel19;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel20;
    private javax.swing.JPanel jPanel21;
    private javax.swing.JPanel jPanel22;
    private javax.swing.JPanel jPanel23;
    private javax.swing.JPanel jPanel24;
    private javax.swing.JPanel jPanel25;
    private javax.swing.JPanel jPanel26;
    private javax.swing.JPanel jPanel27;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JScrollPane jScrollPane4;
    private javax.swing.JScrollPane jScrollPane5;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JSplitPane jSplitPane11;
    private javax.swing.JSplitPane jSplitPane12;
    private javax.swing.JSplitPane jSplitPane13;
    private javax.swing.JSplitPane jSplitPane14;
    private javax.swing.JSplitPane jSplitPane2;
    private javax.swing.JSplitPane jSplitPane3;
    private javax.swing.JSplitPane jSplitPane4;
    private javax.swing.JSplitPane jSplitPane5;
    private javax.swing.JSplitPane jSplitPane6;
    private javax.swing.JSplitPane jSplitPane7;
    private javax.swing.JSplitPane jSplitPane8;
    private javax.swing.JTable jTable2;
    private javax.swing.JLabel labelEstadoPuerto;
    private javax.swing.JLabel labelPuerto;
    private javax.swing.JButton minimizar;
    private javax.swing.JPanel panelFechaHora;
    private javax.swing.JPanel panelGrafica1;
    private javax.swing.JPanel panelPuertoSeial;
    private javax.swing.JPanel panelSistema;
    private javax.swing.JComboBox puerto;
    private javax.swing.JButton salir;
    private javax.swing.JTable tablaDatosR;
    private javax.swing.JTable tablaDatosR1;
    private javax.swing.JTextField ultFecha;
    private javax.swing.JTextField ultFecha2;
    private javax.swing.JTextField ultFecha3;
    private javax.swing.JTextField ultHora;
    private javax.swing.JTextField ultHora1;
    private javax.swing.JTextField ultRegistro;
    // End of variables declaration//GEN-END:variables

//  @Override
//  public void menuItemSelected(SysTrayMenuEvent stme) {
//    throw new UnsupportedOperationException("Not supported yet.");
//  }
//
//  @Override
//  public void iconLeftClicked(SysTrayMenuEvent stme) {
//    throw new UnsupportedOperationException("Not supported yet.");
//  }
//
//  @Override
//  public void iconLeftDoubleClicked(SysTrayMenuEvent stme) {
//    throw new UnsupportedOperationException("Not supported yet.");
//  }
}
